package cn.zptc.dao;

import cn.zptc.entity.Favorite;
import cn.zptc.entity.FavoriteCategory;

import java.sql.SQLException;
import java.util.List;

public interface FavoriteDao {
    /**
     * 根据用户的id查询用户的链接分类
     * @param userId
     * @return 某个用户的链接分类
     */
    List<FavoriteCategory> selectMyFavoriteCategorys(int userId) throws SQLException;

    /**
     * 插入成功返回新增的id，否则返回-1
     * @param favorite
     * @return
     */
    int insert(Favorite favorite) throws SQLException;

    /**
     * 查询出我的收藏
     * @param userId
     * @return
     */
    List<Favorite> selectMyFavorites(int userId) throws SQLException;

    /**
     * 查询用户在收藏中存在的分类
     * @param userId
     * @return
     */
    List<FavoriteCategory> selectMyLinkCategorysInFavorite(int userId) throws SQLException;

    /**
     * 删除一个收藏
     *
     * @param favoriteId
     * @param userId
     * @return
     */
    int deleteFavorite(int favoriteId, int userId) throws SQLException;

    /**
     * 获取我的一个收藏
     *
     * @param favoriteId
     * @param userId
     * @return
     */
    Favorite getFavorite(int favoriteId, int userId) throws SQLException;
}
